   <div id="operate" style="width:700; height:25px;margin-top:10px;">
   <p style="margin-left:15px;width:300px;">
           <a href="#" onclick="new_folder();" style="margin:0 0 3px 0;">
           <a href="#" onclick="new_folder();" style="margin:0 0 3px 0;"> 添加新文件夹</a>&nbsp;&nbsp;
           <span id="new_folder_name" style="width:200px;display:none">
            <input type="text" id="new_folder_name_input"  name="new_folder_name" 
              style="border:1px solid #a5acb2;" size="16" value="" />
            <input type="button"   name="baocun" value="保存"  onclick="create_new_folder();" />
            </span>
   </p>
   </div>
   <div id="folders" style="width:700px;margin-top:0px;">
   <table width="660" border="0" cellpadding="0" cellspacing="0" style="border-left:1px solid #dadada; border-top:1px solid #dadada;">    
           <tr width="600" >
            <td width="200" background="/images/user/report_list/bg_03.jpg" height="30" align="center" valign="middle" style=" border-right:1px solid #dadada;">文件夹名称</td>
            <td width="100" background="/images/user/report_list/bg_03.jpg" height="30" align="center" valign="middle" style=" border-right:1px solid #dadada;">报告数目</td>
           <td width="100" background="/images/user/report_list/bg_03.jpg" height="30" align="center" valign="middle" style=" border-right:1px solid #dadada;">创建时间</td>
            <td width="220" background="/images/user/report_list/bg_03.jpg" height="30" align="center" valign="middle" style=" border-right:1px solid #dadada;" >操作</td>
           </tr>
            <% if @all_folders.size > 0 %>   
             <% @all_folders.each do |folder|%>
             <tr>
             <td  height="25" align="center" valign="middle" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
              <div id="folder_name_show_<%=folder.id %>">             
                 <a href="#" onclick="show_by_folder(<%=folder.id%>); show_div(0);">
                 <%=folder.name -%></a>
             </div>
             <div id="fodler_new_namediv_<%=folder.id %>"  style="display:none">
                 <input type="text"  id="fodler_newName_<%=folder.id %>"  name="fodler_new_name"  style="border:1px solid #a5acb2;" 
                 value="<%=folder.name -%>" size="18" onblur="update_foldername(<%=folder.id%>);" />
                 <!--input type="button"   name="baocun" value="保存"  onclick="update_foldername(<%=folder.id%>);" /-->
              </div>
             </td>
             <td height="25" align="center" valign="middle" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
             <% records_num=SurveyRecord.find(:all ,:conditions=>[" folder_id = ?" ,folder.id.to_s]).size %>
             <%=records_num %>
             </td>
             <td height="25" align="center" valign="middle" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
             <%=folder.created_at.strftime('%Y年%m月%d日')%>
             </td>
              <td height="25" align="center" valign="middle" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
              <a href="#"  onclick="re_name(<%=folder.id%>);">重命名</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <a href="#" onclick="del_folder(<%=folder.id%>); show_div(1);">删除</a></td>
             </tr>
             <% end %>
             <% else %>
             <tr><td height="65" colspan="3"align="center" valign="middle" style="border-bottom:1px solid #dadada; ">
            没有相应文件夹 ！</td></tr>
             <% end %>
    </table>         
    
    <% if @folder_status %>
    
        <% if @all_folders.page_count > 1%>
        <div class="pagination">
        <% if params[:page_num].to_i  && params[:page_num].to_i >1%>
        <a href="#" onclick="get_search_flderpage(<%=params[:page_num].to_i-1%>);"><span>上一页</span></a>|
        <% else %>
        <span>上一页|</span>
        <% end %>
        <% for i in 1..@all_folders.page_count%>
        <% if i==params[:page_num].to_i %>
        <span>&nbsp;<%=i%>&nbsp;|</span>
        <% else %>
        <a href="#" onclick="get_search_flderpage(<%=i%>);"><span>&nbsp;<%=i%>&nbsp;</span></a>|
        <% end %>
        <% end %>
        <% if params[:page_num].to_i >0&& params[:page_num].to_i < @all_folders.page_count %>
        <a href="#" onclick="get_search_flderpage(<%=params[:page_num].to_i+1%>);"><span>下一页</span></a>
        <% else %>
        <span>下一页</span>
        <% end %>
        </div>
        <% end %>
    <% else %>
         <% if @all_folders.page_count > 1%>
      <div class="pagination">
      <% if params[:page_num].to_i  && params[:page_num].to_i >1%>
      <a href="#" onclick="get_folder_page(<%=params[:page_num].to_i-1%>);"><span>上一页</span></a>|
      <% else %>
      <span>上一页|</span>
      <% end %>
      <% for i in 1..@all_folders.page_count%>
      <% if i==params[:page_num].to_i %>
      <span>&nbsp;<%=i%>&nbsp;|</span>
      <% else %>
      <a href="#" onclick="get_folder_page(<%=i%>);"><span>&nbsp;<%=i%>&nbsp;</span></a>|
      <% end %>
      <% end %>
      <% if params[:page_num].to_i >0&& params[:page_num].to_i < @all_folders.page_count %>
      <a href="#" onclick="get_folder_page(<%=params[:page_num].to_i+1%>);"><span>下一页</span></a>
      <% else %>
      <span>下一页</span>
      <% end %>
      </div>
      <% end %>
    
    <% end %>
    
    </div>
    
    <script>
    function re_name(id){
    
    $("fodler_new_namediv_"+id).show();
    $("folder_name_show_"+id).hide();
    }
    
    function update_foldername(f_id){
      var new_name=$("fodler_newName_"+f_id).value;
      // alert(new_name);
      if(new_name.length > 0){
           var pars="name="+new_name+"&folder_id= "+f_id;
            new Ajax.Updater(
            'folders',
            "/user/reports/rename_folder",
            {
            method: 'get',
            parameters: pars
            });
       }
     }
     
     function del_folder(id){
       var pars="f_id="+id;
       new Ajax.Updater(
            'folders',
            "/user/reports/del_folder",
            {
            method: 'get',
            parameters: pars
            });
    }
    
    function get_folder_page(page){
     var pars="page_num="+page;
     new Ajax.Updater(
            'folders',
            "/user/reports/get_npage_folder",
            {
            method: 'get',
            parameters: pars
            });
   }
   
   function get_search_flderpage(page){
     var page_n=document.getElementById("folder_page_num");
     page_n.value=page;
     sm_folder();
    }
    </script>
